Control legacy GL context via environment variable
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 6 Oct 2015 18:57:45 +0000 (19:57 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 7 Oct 2015 15:21:57 +0000 (16:21 +0100)
For testing purposes, we may want to force the creation of legacy GL
contexts via an environment variable.

https://bugzilla.gnome.org/show_bug.cgi?id=756142

gdk/gdk.c
gdk/gdkinternals.h
gdk/x11/gdkglcontext-x11.c

index d86ea858044eb333ab2cb20a02ff46fff221d888..25e6287b285670424ad71bc52a96036b55d3e8c0 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -144,6 +144,7 @@ static const GDebugKey gdk_gl_keys[] = {
   {"software-draw-gl",      GDK_GL_SOFTWARE_DRAW_GL},
   {"software-draw-surface", GDK_GL_SOFTWARE_DRAW_SURFACE},
   {"texture-rectangle",     GDK_GL_TEXTURE_RECTANGLE},
+  {"legacy",                GDK_GL_LEGACY},
 };
 
 #ifdef G_ENABLE_DEBUG
index 718a02db98d5c72c2b33f144d6efdc4dd6c3270f..b75eb3a9fb2f1028a34b55c678d3f7b93bb2e720 100644 (file)
@@ -99,7 +99,8 @@ typedef enum {
   GDK_GL_ALWAYS                 = 1 << 1,
   GDK_GL_SOFTWARE_DRAW_GL       = 1 << 2,
   GDK_GL_SOFTWARE_DRAW_SURFACE  = 1 << 3,
-  GDK_GL_TEXTURE_RECTANGLE      = 1 << 4
+  GDK_GL_TEXTURE_RECTANGLE      = 1 << 4,
+  GDK_GL_LEGACY                 = 1 << 5
 } GdkGLFlags;
 
 extern GList            *_gdk_default_filters;
index acbdd522be0d186a9045d442e2e7df19ed0fbd4a..1bb8ac24909a19640cb201e7310683aa640da0fe 100644 (file)
@@ -638,7 +638,8 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
   compat_bit = gdk_gl_context_get_forward_compatible (context);
 
   /* If there is no glXCreateContextAttribsARB() then we default to legacy */
-  legacy_bit = !GDK_X11_DISPLAY (display)->has_glx_create_context;
+  legacy_bit = !GDK_X11_DISPLAY (display)->has_glx_create_context ||
+               (_gdk_gl_flags & GDK_GL_LEGACY) != 0;
 
   /* We cannot share legacy contexts with core profile ones, so the
    * shared context is the one that decides if we're going to create